# -*- coding: utf-8 -*-
# @Time    : 2021/12/16 10:58
# @Email   : 849080458@qq.com
# @Author  : zgh
# @FileName: day03_response响应.py
# @Software: PyCharm
import json

from flask import Flask, make_response, jsonify

app = Flask(__name__)
app.config['JSON_AS_ASCII'] = False


@app.route('/')
def index():
    # 1、构造你的响应头
    # return json.dumps({'username': '猛猛小蚂蚁'}), 201 ,{"content-type":"applocation/json"}
    # 2、make_response()
    # r = make_response(json.dumps({'username': '猛猛小蚂蚁'}), {"content-type": "applocation/json"})
    # r.status = '203'
    r = jsonify({'username': '猛猛小蚂蚁'})
    r.status = '201'
    return r


if __name__ == '__main__':
    app.run(debug=True)
